﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PloobsEngine.Physics;
using PloobsEngine.Input;
using PloobsEngine.Publishers;
using PloobsEngine.SceneControl;
using PloobsEngine.Cameras;
using PloobsEngine.Commands;


namespace PloobsEngine.Features
{
    public class PickingParameters : ICommand
    {
        private ICamera cam = null;
        private IWorld world;
        private IList<IObserver> obs = new List<IObserver>();
        private Picking picking;
        private MouseButtons mb;
        private SegmentInterceptMethod method = SegmentInterceptMethod.NO_TRINAGLEMESH;

        public SegmentInterceptMethod Method
        {
            get { return method; }
            set { method = value; }
        }

        public IList<IObserver> Observers
        {
            get
            {
                return obs;
            }
        }
        
        public PickingParameters(ICamera cam, IWorld world,MouseButtons mb)
        {
            this.cam = cam;
            this.world = world;
            this.mb = mb;
        }

        /// <summary>
        /// All the frames the ray is calculated
        /// </summary>
        /// <param name="cam"></param>
        /// <param name="world"></param>
        public PickingParameters(ICamera cam, IWorld world)
        {
            this.cam = cam;
            this.world = world;
            this.mb = MouseButtons.None;
        }        

        #region ICommand Members

        public void execute()
        {
            picking.SetParameters(cam, world, obs,mb,method);
        }

        #endregion

        #region ICommand Members


        public string TargetName
        {
            get { return Picking.MyName; }
        }

        #endregion
    
        #region ICommand Members


        public void  setTarget(object obj)
        {
            this.picking = obj as Picking;
        }

        #endregion
}
}
